class User < ActiveRecord::Base

    include Account::AccountModel
    
    has_many :didilies
        
    #########################################################
    # gets a list of tags used by the current user
    def get_tags
        sql = "SELECT tags.id, tags.name, COUNT(tags.id) AS count "
        sql << "FROM tags "
        sql << "INNER JOIN didilies_tags ON didilies_tags.tag_id = tags.id "
        sql << "INNER JOIN didilies ON didilies.id = didilies_tags.didily_id "
        sql << "WHERE didilies.user_id = ? "
        sql << "GROUP BY tags.id, tags.name "
        sql << "ORDER BY tags.name ASC "
        
        add_limit!(sql, options)
        self.find_by_sql([sql, self.id])      
    end
    
    
end
